#ifndef __ASM_ARM_MEMORY_H
#define __ASM_ARM_MEMORY_H

#include <asm/page.h>

#define CONFIG_DRAM_BASE 0x80000000

#define PHYS_OFFSET 	(CONFIG_DRAM_BASE)
#define PAGE_OFFSET		(0xC0000000)

#define TASK_SIZE		((PAGE_OFFSET) - (0x01000000))
#define TASK_UNMAPPED_BASE	((PAGE_OFFSET) / 3)

#define MODULES_VADDR		(PAGE_OFFSET - 16*1024*1024)

#define __virt_to_phys(x)	((x) - PAGE_OFFSET + PHYS_OFFSET)
#define __phys_to_virt(x)	((x) - PHYS_OFFSET + PAGE_OFFSET)

static inline unsigned long virt_to_phys(void *x)
{
	return __virt_to_phys((unsigned long)(x));
}

static inline void *phys_to_virt(unsigned long x)
{
	return (void *)(__phys_to_virt((unsigned long)(x)));
}

#define __pa(x)			__virt_to_phys((unsigned long)(x))
#define __va(x)			((void *)__phys_to_virt((unsigned long)(x)))

#define PHYS_TO_NID(addr)	(0)

#define	__phys_to_pfn(paddr)	((paddr) >> PAGE_SHIFT)
#define	__pfn_to_phys(pfn)	((pfn) << PAGE_SHIFT)

#define PHYS_PFN_OFFSET	(PHYS_OFFSET >> PAGE_SHIFT)
#define ARCH_PFN_OFFSET		PHYS_PFN_OFFSET

#define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
#define page_to_virt(page)	__va(__pfn_to_phys(page_to_pfn(page)))

// #define virt_to_page(addr)	(mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
// #define page_to_virt(page)	((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)

#endif
